package com.example.myapplication.DesignPatterns.strategy;

import java.math.BigDecimal;

/**
 * 优惠上下文
 */
public class PreferentialContent {
    private PreferentialStrategy priceIStrategy;
    //注入优惠策略
    public PreferentialContent(PreferentialStrategy priceIStrategy){
        this.priceIStrategy = priceIStrategy;
    }
    //回调具体优惠策略的方法
    public BigDecimal getPrice(BigDecimal bigDecimal){
        return priceIStrategy.getPrice(bigDecimal);
    }
}
